package com.hy.mydesktop.server.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.hy.jpa.connection.T;
import com.hy.mydesktop.server.dao.GxtComponentMetaNodeModelDao;
import com.hy.mydesktop.shared.persistence.domain.gxt.GxtComponentControllerMetaModel;
import com.hy.mydesktop.shared.persistence.domain.gxt.GxtComponentMetaNodeModel;

@Component("gxtComponentMetaNodeModelService")
public class GxtComponentMetaNodeModelServiceImpl implements
		GxtComponentMetaNodeModelService {

	GxtComponentMetaNodeModelDao gxtComponentMetaNodeModelDao=null;
	
	@Resource(name="gxtComponentMetaNodeModelDao")
	@Override
	public void setGxtComponentMetaNodeModelDao(
			GxtComponentMetaNodeModelDao<GxtComponentMetaNodeModel> gxtComponentMetaNodeModelDao) {
		this.gxtComponentMetaNodeModelDao=gxtComponentMetaNodeModelDao;

	}

	@Override
	public Boolean addGxtComponentMetaNodeModel(
			GxtComponentMetaNodeModel gxtComponentMetaNodeModel) {
		return gxtComponentMetaNodeModelDao.persist(gxtComponentMetaNodeModel);
		//return null;
	}

	

	

	@Override
	public List<GxtComponentMetaNodeModel> findAllGxtComponentMetaNodeModels() {
		return gxtComponentMetaNodeModelDao.find();
		//return null;
	}

	

	

	@Override
	public GxtComponentMetaNodeModel findGxtComponentMetaNodeModelByIdentifier(
			String identifier) {
		return (GxtComponentMetaNodeModel)gxtComponentMetaNodeModelDao.findByIdentifier(identifier);
		//return null;
	}

	@Override
	public GxtComponentMetaNodeModel findByGxtComponentId(String id) {
		return gxtComponentMetaNodeModelDao.findByGxtComponentId(id);
		//return null;
	}

	@Override
	public Boolean updateGxtComponentMetaNodeModel(
			GxtComponentControllerMetaModel componentControllerMetaModel) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Boolean updateGxtComponentMetaNodeModels(
			List<GxtComponentControllerMetaModel> componentControllerMetaModels) {
		// TODO Auto-generated method stub
		return null;
	}
	
	@Override
	public Boolean deleteGxtComponentMetaNodeModel(
			GxtComponentMetaNodeModel gxtComponentMetaNodeModel) {
		return gxtComponentMetaNodeModelDao.remove(gxtComponentMetaNodeModel);
		//return null;
	}

	@Override
	public Boolean deleteByGxtComponentId(String id) {
		
//		return gxtComponentMetaNodeModelDao.remove(gxtComponentMetaNodeModelDao.findByGxtComponentId(id));
		gxtComponentMetaNodeModelDao.cascadeRemove(gxtComponentMetaNodeModelDao.findByGxtComponentId(id));
		return true;
	}

	@Override
	public Boolean deleteGxtComponentMetaNodeModelByIdentifier(
			String identifier) {
		return gxtComponentMetaNodeModelDao.remove(identifier);

	}

	@Override
	public void persistT(T t) {
		gxtComponentMetaNodeModelDao.getEntityManager().persist(t);
		
	}

	

}
